#ifndef __CDynamicArray_H__
#define __CDynamicArray_H__

#define INITIAL_MAX_SIZE 1000

/** 
This class enables to store the data and resize the data array according to our needs. 
the PESs are of this class because the PES's length is unknown and using this class we can extend
the data array size as much as we need (till we get the whole PES ).
*/
class CDynamicArray
{
public:
    /** 
	c'tor
	by deafault,allocates an array of INITIAL_MAX_SIZE.
	also allows the user to determine the initial size of the array by sending it in the c'tor.
	@param nInitialMaxSize- specifies the initial size of the data array. by default it set to 
                            INITIAL_MAX_SIZE, also can be set by a user.
   */
	CDynamicArray(int nInitialMaxSize = INITIAL_MAX_SIZE);
    /**
	c'tor
	 copies the data from the cDynamicArray class into the array.updates the array size according to the data
	 that was copied.
     @param cDynamicArray - the cDynamicArray class whose data array should be copied. 
	 */
	CDynamicArray(CDynamicArray* cDynamicArray);
	/**
	d'tor
	
    */
	~CDynamicArray(void);
   /**
   copies the source data into the class array.Increases the class's array size its new size value.
   @param source- a pointer to the array the data should be copied from
   @param size- the size of the data (in bytes) that should be copied
   */
	void copyToArray(const char* source, unsigned int size);
    char* m_cArray;
	unsigned int m_nSize;
private:
	/** allocates an array of the current size plus 5 times the nNewSize.copies the previous array stored data
	   into the new array 
   */
	void _resize(int nNewSize);

	int m_nFreeSize;
};

#endif
